This application relates to and incorporates herein by reference Japanese Patent Application No. 11-12002 filed on Jan. 20, 1999.
1. Field of the Invention
The present invention relates to an electronic control apparatus to control a control target in accordance with an object-oriented program.
2. Related Art
In an electronic control apparatus for controlling a vehicle engine program, executed by a microcomputer (specifically, a CPU of a microcomputer), is proposed for each type of engine control. For example, relating to fuel injection control, a program has been devised for each type of control, such as ordinary injection control synchronized to engine rotation speed, injection control asynchronous with engine rotation speed, or fuel cutoff control during high rotation. There are numerous common portions in each program.
It is therefore proposed in U.S. patent application Ser. No. 09/104,967 (EP 0892 342 A2) to devise a control program (perform programming) by an object-oriented approach, similarly to a case of a personal computer or the like, in an electronic control apparatus of this type as well. Here, an object is a software module uniting data and a program (method) which is a procedure to process this data. With object-oriented programming, all functions of a control program are subdivided into each unit function for each component or the like, and an object is provided for each of these unit functions. Accordingly, object-oriented programming utilizes a way of thinking known as inter-object message communication to perform exchange of messages between objects for linking respective objects.
However, in an electronic control apparatus of this type, even when a control program thereof is devised with object orientation, no effective measures exist for causing exchange of messages among the respective objects (i.e., inter-object message communication). That is, the proposed apparatus still requires a large amount of storage area of RAM, because the values of a program counter and various registers must be stored in a stack area of RAM. In particular, the larger the number of nesting (i.e., combinations of calls composed of multiple hierarchical levels), the markedly greater the consumed storage area of RAM. Thus, effective use of memory resources are restricted.
It is an object of the present invention to provide an electronic control apparatus capable of performing object processing by dividing a control program into respective unit functions in real time without requiring a lot of memory resources, and being capable of easily realizing time waiting processing.
According to the present invention, a plurality of means for unit processing are provided to respectively perform processing, in accordance with an object of a program subdivided into each unit function for controlling a control target, to realize the respective unit functions. Here, the unit processing means are functional means realized by operation of a CPU of a microcomputer. Accordingly, any one of the plurality of unit processing means selectively performs a processing task, and together therewith, by the respective unit processing means issues a message as a processing request to other unit processing means which is an output designation of a message thereof to perform processing.
In one aspect, the message generated by each unit processing means is categorized into a first type message which does not contain the count value for indicating the delay time until the time when the destination unit processing means of the message starts the process operation, and a second type message which contains the count value.
The electronic control apparatus is provided with a first storage control means for storing a first type message generated from a unit processing means in a first message storage means and an activation control means. The activation control means reads out the first type message which has been first stored among first type messages stored in the first message storage means at the point in time when any one of a plurality of unit processing means has completed the process operation, activates the destination unit processing means of the read out first type message to start the process, and deletes the read out first type message from the first message storage means.
As a result, when any one of the unit processing means starts the process operation and sends out the first type message to another unit processing means during the process operation, the first type message is stored in the first message storage means by the first storage control means. When the process operation of the unit processing means which has generated the first type message is completed, from that point in time, the process of the destination unit processing means of the stored first type message is started. When an object in process operation generates a first type message to any one of the objects, the first type message is stored temporarily in the first message storage means, and when the process of the object which has generated the first type message is completed, the process of the destination object of the stored first type message is immediately performed.
Furthermore, when unit processing means successively generates first type messages to a plurality of unit processing means during process operation, the first type messages are successively stored in the first message storage means by the first-storage control means. When the process operation of the unit processing means which had generated the first type messages is completed, the process of destination unit processing means of the stored plurality of first type messages is performed in the storing order of the first type messages (output order).
In another aspect of the electronic control apparatus, when a unit processing means sends a timer message (second type message which contains the count value for indicating the delay time until the starting of the process operation) to the unit processing means itself or another unit processing means during the process operation, the timer message is stored in timer message storage means by timer message storage control means. The count value of the timer message stored in the timer message storage means is reduced by a predetermined value every time a predetermined event occurs. When the count value reaches a predetermined set value, the process of the unit processing means corresponding to the destination of the timer message is started.
As a result, the process of unit processing means corresponding to the destination of the timer message is performed after an elapse of a time corresponding to the count value contained in the timer message, the time waiting process, that is, the process of a specific object (process of a unit processing means) is started after an elapse of a predetermined time from a certain point in time, can be easily realized.